package com.ruoyi.car.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.CarCompanyMapper;
import com.ruoyi.car.domain.CarCompany;
import com.ruoyi.car.service.ICarCompanyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 车辆所属车企Service业务层处理
 * 
 * @author zls
 * @date 2020-03-29
 */
@Service
public class CarCompanyServiceImpl implements ICarCompanyService 
{
    @Autowired
    private CarCompanyMapper carCompanyMapper;

    /**
     * 查询车辆所属车企
     * 
     * @param id 车辆所属车企ID
     * @return 车辆所属车企
     */
    @Override
    public CarCompany selectCarCompanyById(Long id)
    {
        return carCompanyMapper.selectCarCompanyById(id);
    }

    /**
     * 查询车辆所属车企列表
     * 
     * @param carCompany 车辆所属车企
     * @return 车辆所属车企
     */
    @Override
    public List<CarCompany> selectCarCompanyList(CarCompany carCompany)
    {
        return carCompanyMapper.selectCarCompanyList(carCompany);
    }

    /**
     * 新增车辆所属车企
     * 
     * @param carCompany 车辆所属车企
     * @return 结果
     */
    @Override
    public int insertCarCompany(CarCompany carCompany)
    {
        carCompany.setCreateTime(DateUtils.getNowDate());
        return carCompanyMapper.insertCarCompany(carCompany);
    }

    /**
     * 修改车辆所属车企
     * 
     * @param carCompany 车辆所属车企
     * @return 结果
     */
    @Override
    public int updateCarCompany(CarCompany carCompany)
    {
        carCompany.setUpdateTime(DateUtils.getNowDate());
        return carCompanyMapper.updateCarCompany(carCompany);
    }

    /**
     * 删除车辆所属车企对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCarCompanyByIds(String ids)
    {
        return carCompanyMapper.deleteCarCompanyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除车辆所属车企信息
     * 
     * @param id 车辆所属车企ID
     * @return 结果
     */
    @Override
    public int deleteCarCompanyById(Long id)
    {
        return carCompanyMapper.deleteCarCompanyById(id);
    }
}
